﻿using System.Diagnostics.Contracts;

namespace O1.Kernel.IO.Storage
{
    [ContractVerification(true)]
    internal class StorageTask
    {
        public readonly TransactionToken Token;

        public readonly DmlOperation Operation;

        public StorageTask(TransactionToken token, DmlOperation operation)
        {
            Contract.Requires(token != null);

            this.Token = token;
            this.Operation = operation;
        }

        public TaskState State { get; set; }

        public int TargetId { get; set; }

        [ContractInvariantMethod]
        private void ObjectInvariant()
        {
            Contract.Invariant(this.Token != null);
        }
    }
}
